package com.serkol.bean;


import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Getter;

@Getter
public class MyPage<T> {

    private long total;


    private long current;

    private long size;
    private long pages;
    private Object list;

    public void setTotal(long total) {
        this.total = total;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public void setList(Object list) {
        this.list = list;
    }

    public void setPages(long pages) {
        this.pages = pages;
    }

    public  static MyPage parsePage(IPage page) {
        MyPage myPage = new MyPage();
        myPage.setCurrent(page.getCurrent());
        myPage.setSize(page.getSize());
        myPage.setTotal(page.getTotal());
        myPage.setPages(page.getPages());
        myPage.setList(page.getRecords());
        return myPage;
    }

    @Override
    public String toString() {
        return "MyPage{" +
                "total=" + total +
                ", current=" + current +
                ", size=" + size +
                ", pages=" + pages +
                ", list=" + list +
                '}';
    }
}